<form method="post" action="<?= base_url()."pelayan/save_pesanan" ?>" >
	<h1>Tambah Pesanan</h1>
	
	<table cellspacing="5">
		<tr>
			<td>Tanggal Pemesanan</td>
			<td><?= date('Y-m-d H:i:s') ?></td>
		</tr>
		<tr>
			<td>No. Meja</td>
			<td><input type="text" name="no_meja" /></td>
		</tr>
		<tr>
			<td>Menu</td>
			<td>
				<div style="overflow: scroll; height: 200px; float: left; margin-right:5px">
					<h2>Appetizer</h2>
					<?php foreach($appetizers as $appetizer) { ?>
						<div>
							<input class="mn-clicker" type="checkbox" name="menus[]" value="<?=$appetizer['id_menu']?>"><?=$appetizer['nama'] ."&nbsp; &nbsp; (Rp. ". $appetizer['harga'] .")"?></input><br/>
							<input class="mn-jumlah" type="text" name="jumlah[]" size="3" disabled /><br/>
						</div>
					<?php } ?>
				</div>
				<div style="overflow: scroll; height: 200px; float: left; margin-right:5px">
					<h2>Main Course</h2>
					<?php foreach($main_courses as $main_course) { ?>
						<div>
							<input class="mn-clicker" type="checkbox" name="menus[]" value="<?=$main_course['id_menu']?>"><?=$main_course['nama'] ."&nbsp; &nbsp; (Rp. ". $main_course['harga'] .")"?></input><br/>
							<input class="mn-jumlah" type="text" name="jumlah[]" size="3" disabled /><br/>
						</div>
					<?php } ?>
				</div>
				<div style="overflow: scroll; height: 200px; float: left; margin-right:5px">
					<h2>Dessert</h2>
					<?php foreach($desserts as $dessert) { ?>
						<div>
							<input class="mn-clicker" type="checkbox" name="menus[]" value="<?=$dessert['id_menu']?>"><?=$dessert['nama'] ."&nbsp; &nbsp; (Rp. ". $dessert['harga'] .")"?></input><br/>
							<input class="mn-jumlah" type="text" name="jumlah[]" size="3" disabled /><br/>
						</div>
					<?php } ?>
				</div>
				<div style="overflow: scroll; height: 200px; float: left">
					<h2>Minuman</h2>
					<?php foreach($beverages as $beverage) { ?>
						<div>
							<input class="mn-clicker" type="checkbox" name="menus[]" value="<?=$beverage['id_menu']?>"><?=$beverage['nama'] ."&nbsp; &nbsp; (Rp. ". $beverage['harga'] .")"?></input><br/>
							<input class="mn-jumlah" type="text" name="jumlah[]" size="3" disabled /><br/>
						</div>
					<?php } ?>
				</div>
			</td>
		</tr>
		<tr>
			<td>Paket Makan</td>
			<td>
				<div style="overflow: scroll; height: 200px; float: left; margin-right:5px">
					<h2>Paket Spesial Karnivor</h2>
					<?php foreach($packets as $packet) { ?>
						<div>
							<input class="mn-clicker" type="checkbox" name="packets[]" value="<?=$packet['id_paket']?>"><?=$packet['nama'] ."&nbsp; &nbsp; (Rp. ". $packet['harga'] .")"?></input><br/>
							<input class="mn-jumlah" type="text" name="jumlah_paket[]" size="3" disabled /><br/>
						</div>
					<?php } ?>
				</div>
			</td>
		</tr>
		<tr>
			<td></td>
			<td>	
				<input type="reset" value="Atur Ulang" />
				<input type="submit" value="Kirim" name="submit" />
			</td>
		</tr>
	</table>
</form>

<script>
$(document).ready(function(){
	$('.mn-clicker').click(function(){
		var elem_parent = $(this).parent();
		if($(this).is(':checked')){
			elem_parent.find('.mn-jumlah').removeAttr('disabled');
		}else{
			elem_parent.find('.mn-jumlah').attr('disabled', 'disabled');
		}
	});
});
</script>